<?php

include_once '../php-ofc-library/open-flash-chart.php';

$title = new title( 'Chart 4: XXX' );
$title->set_style('{font-size: 20px; color:#000000; font-family: Verdana; text-align: center}');

$bar_stack = new bar_stack();

// set a cycle of 3 colours:
$bar_stack->set_colours( array( '#C4D318', '#50284A', '#7D7B6A', '#ff0000', '#ff00ff') );

// add 3 bars:
$bar_stack->append_stack( array( 2.5, 5, 2.5, 3) );

// add 4 bars, the fourth will be the same colour as the first:
$bar_stack->append_stack( array( 2.5, 2, 1.25, 1.25 ) );


$bar_stack->append_stack( array( 5, 1, 3, 0, 4 ) );
$bar_stack->append_stack( array( 2, 2, 2, 2, 2 ) );

$bar_stack->set_keys(
    array(
        new bar_stack_key( '#C4D318', 'key_1', 13 ),
        new bar_stack_key( '#50284A', 'key_2', 13 ),
        new bar_stack_key( '#7D7B6A', 'key_3', 13 ),
        new bar_stack_key( '#ff0000', 'key_4', 13 ),
        new bar_stack_key( '#ff00ff', 'key_5', 13 ),
        )
    );
$bar_stack->set_tooltip( '#x_label# Value: [#val#]<br>Total [#total#]' );



$y = new y_axis();
$y->set_range( 0, 14, 2 );
$x = new x_axis();
$x->set_labels_from_array( array( 'XL_1', 'XL_2', 'XL_3', 'XL_4' ) );
$x_legend = new x_legend( 'X Legend' );
$x_legend->set_style( '{font-size: 16px; color: #000000}' );
$y_legend = new y_legend( 'Y Legend' );
$y_legend->set_style( '{font-size: 16px; color: #000000}' );

$tooltip = new tooltip();
$tooltip->set_hover();

$chart = new open_flash_chart();
$chart->set_bg_colour( '#FFFFFF' );
$chart->set_title( $title );
$chart->add_element( $bar_stack );
$chart->set_x_axis( $x );
$chart->add_y_axis( $y );
$chart->set_x_legend( $x_legend );
$chart->set_y_legend( $y_legend );
$chart->set_tooltip( $tooltip );

echo $chart->toPrettyString();

?>
